import 'package:pkg_obz/export.dart';
import 'package:pkg_obz/widgets.dart';

/// Create： Zhang 2021/6/28 10:28 上午
/// erp:     ext.zhangjunfei
/// 描述：页面数据
class IndexPageModel extends PageModel {
  ///刷新控制器
  final RefreshController refreshController =
      RefreshController(initialRefresh: false);

  List<String> indexItems = [
    "弹框",
    "日期格式化",
    "时间选择",
    "照片选择",
    "扫描二维码",
    "获取版本号",
    "百度地图",
    "通用标题栏",
    "沙漏加载",
    "轮播图",
    "虚线",
    "评星",
    "SliverAppbar",
    "状态管理"
  ];

  ///刷新数据
  void refreshData() {
    Future.delayed(Duration(seconds: 1))
        //结束刷新
        .then((value) => refreshController.refreshCompleted());
  }

  ///加载更多数据
  void loadMoreData() {
    Future.delayed(Duration(seconds: 1)).then((value) {
      indexItems.add("加载更多");
      //结束加载更多
      refreshController.loadComplete();
      //刷新页面，此方法刷新整个页面
      notify();
    });
  }
}
